/*
 *  Timer.cpp
 *  powaah
 *
 *  Created by Tim Uusitalo on 4/19/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include "Timer.h"

Timer::Timer()
{
}

Timer::~Timer()
{
}

void Timer::startTimer()
{
	gettimeofday(&start, NULL);
}

const float Timer::elapsedTime()
{
	timeval now;
	gettimeofday(&start, NULL);
	
	return (now.tv_usec - start.tv_usec)*0.00000000001;
}

const float Timer::accumulate()
{
	float clock = std::clock();
	
	float val = ((clock - last_acc) / CLOCKS_PER_SEC);
	
	last_acc = clock;
	
	return val;
}

